<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    hostname: new URL('http://yoursite.com').hostname,
    root: '/',
    scheme: 'Pisces',
    version: '7.6.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    comments: {"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: '',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}
  };
</script>

  <meta name="description" content="什么是USB网络设备驱动。网络设备驱动USB设备驱动">
<meta property="og:type" content="article">
<meta property="og:title" content="USB网络设备驱动">
<meta property="og:url" content="http://yoursite.com/2021/07/08/USB%E7%BD%91%E7%BB%9C%E8%AE%BE%E5%A4%87%E9%A9%B1%E5%8A%A8/index.html">
<meta property="og:site_name" content="SRCNN">
<meta property="og:description" content="什么是USB网络设备驱动。网络设备驱动USB设备驱动">
<meta property="og:locale" content="en_US">
<meta property="article:published_time" content="2021-07-08T15:31:57.000Z">
<meta property="article:modified_time" content="2021-10-20T14:32:15.956Z">
<meta property="article:author" content="Z.J. Jiang">
<meta property="article:tag" content="SISR">
<meta property="article:tag" content=" FH">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://yoursite.com/2021/07/08/USB%E7%BD%91%E7%BB%9C%E8%AE%BE%E5%A4%87%E9%A9%B1%E5%8A%A8/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true
  };
</script>

  <title>USB网络设备驱动 | SRCNN</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">SRCNN</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">SISR-FH</p>
  </div>

  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>Home</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>Tags</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>Categories</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>Archives</a>

  </li>
  </ul>

</nav>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="en">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2021/07/08/USB%E7%BD%91%E7%BB%9C%E8%AE%BE%E5%A4%87%E9%A9%B1%E5%8A%A8/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="Z.J. Jiang">
      <meta itemprop="description" content="about the single image super-resolution and face hallucination">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="SRCNN">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          USB网络设备驱动
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">Posted on</span>

              <time title="Created: 2021-07-08 23:31:57" itemprop="dateCreated datePublished" datetime="2021-07-08T23:31:57+08:00">2021-07-08</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                <span class="post-meta-item-text">Edited on</span>
                <time title="Modified: 2021-10-20 22:32:15" itemprop="dateModified" datetime="2021-10-20T22:32:15+08:00">2021-10-20</time>
              </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="什么是USB网络设备驱动。"><a href="#什么是USB网络设备驱动。" class="headerlink" title="什么是USB网络设备驱动。"></a>什么是USB网络设备驱动。</h1><h1 id="网络设备驱动"><a href="#网络设备驱动" class="headerlink" title="网络设备驱动"></a>网络设备驱动</h1><h1 id="USB设备驱动"><a href="#USB设备驱动" class="headerlink" title="USB设备驱动"></a>USB设备驱动</h1><a id="more"></a>
<h1 id="Model"><a href="#Model" class="headerlink" title="Model"></a>Model</h1><h1 id="Training-Detail"><a href="#Training-Detail" class="headerlink" title="Training Detail"></a>Training Detail</h1><h1 id="PyTorch-Code"><a href="#PyTorch-Code" class="headerlink" title="PyTorch Code"></a>PyTorch Code</h1><h1 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h1><p><a href="">论文地址</a><br><a href="">参考代码</a></p>
<p>网络设备驱动的特点</p>
<ol>
<li>网络设备是通过sk_buff来像上层提交设备的。</li>
<li>在Linux中，整个协议栈都是在内核里的，驱动只是最底下的一层。</li>
</ol>
<p>网络看协议接口层<br>主要功能<br>给上层协议提供统一的数据包收发接口，无论上层是ARP协议还是IP协议，都通过dev_queue_xmit函数发送数据，通过netif_rx函数接收数据。此层使上层协议独立于具体的设备。</p>
<p>为网络驱动提供一系列netif开头的函数<br>激活设备发送队列 netif_start_queue<br>xxxx</p>
<p>网络设备接口层。<br>为千变万化的网络设备定义统一的、抽象的数据结构net_device结构体，以不变应万变，实现多种硬件在软件层面上的统一。</p>
<p>sk_buff以及围绕sk_buff的操作。</p>
<p>.usbdrv.probe = rtw_drv_init<br>rtw_drv_init：USB初始化<br>    rtw_usb_if1_init 初始化网络设备驱动</p>
<p>加载模块后调用的函数名称<br>rtw_drv_entry 入口</p>
<p>// USB驱动的回调函数。<br>struct rtw_usb_drv usb_drv = {<br>    .usbdrv.name =(char*)DRV_NAME,<br>    .usbdrv.probe = rtw_drv_init,<br>    .usbdrv.disconnect = rtw_dev_remove,<br>    .usbdrv.id_table = rtw_usb_id_tbl,<br>    .usbdrv.suspend =  rtw_suspend,<br>    .usbdrv.resume = rtw_resume,</p>
<pre><code>#if (LINUX_VERSION_CODE &gt; KERNEL_VERSION(2, 6, 22))
  .usbdrv.reset_resume   = rtw_resume,
#endif
#ifdef CONFIG_AUTOSUSPEND
.usbdrv.supports_autosuspend = 1,
#endif

#if (LINUX_VERSION_CODE &gt;= KERNEL_VERSION(2, 6, 19))
.usbdrv.drvwrap.driver.shutdown = rtw_dev_shutdown,
#else
.usbdrv.driver.shutdown = rtw_dev_shutdown,
#endif
</code></pre><p>};</p>
<p><a href="https://blog.csdn.net/lcokenm/article/details/46572967" target="_blank" rel="noopener">https://blog.csdn.net/lcokenm/article/details/46572967</a><br><a href="https://blog.csdn.net/lcokenm/article/details/46574567?spm=1001.2014.3001.5501" target="_blank" rel="noopener">https://blog.csdn.net/lcokenm/article/details/46574567?spm=1001.2014.3001.5501</a></p>
<p>入口函数<br>rtw_drv_entry</p>
<p>wifi相关知识：<br><a href="https://blog.csdn.net/Righthek/article/details/39347723?spm=1001.2014.3001.5502" target="_blank" rel="noopener">https://blog.csdn.net/Righthek/article/details/39347723?spm=1001.2014.3001.5502</a><br><a href="https://blog.csdn.net/Righthek/article/details/39994295?spm=1001.2014.3001.5502" target="_blank" rel="noopener">https://blog.csdn.net/Righthek/article/details/39994295?spm=1001.2014.3001.5502</a></p>
<p>现在我们可以这样来看，从硬件层面上看，WIFI设备与CPU通信是通过USB接口的，与其他WIFI设备之间的通信是通过无线射频（RF）。从软件层面上看，Linux操作系统要管理WIFI设备，那么就要将WIFI设备挂载到USB总线上，通过USB子系统实现管理。而同时为了对接网络，又将WIFI设备封装成一个网络设备。</p>
<p>我们以USB接口的WIFI模块进行分析：</p>
<p>（1）从USB总线的角度去看，它是USB设备；</p>
<p>（2）从Linux设备的分类上看，它又是网络设备；</p>
<p>（3）从WIFI本身的角度去看，它又有自己独特的功能及属性，因此它又是一个私有的设备；</p>
<p> 1、现在我们先从USB设备开始，要写一个USB设备驱动，那么大致步骤如下：</p>
<p>1）需要针对该设备定义一个USB驱动，对应到代码中即定义一个usb_driver结构体变量。代码如下：<br>struct rtw_usb_drv {<br>    struct usb_driver usbdrv;<br>    int drv_registered;<br>    u8 hw_type;<br>};</p>
<p>struct rtw_usb_drv usb_drv = {<br>    .usbdrv.name =(char*)DRV_NAME,<br>    .usbdrv.probe = rtw_drv_init,<br>    .usbdrv.disconnect = rtw_dev_remove,<br>    .usbdrv.id_table = rtw_usb_id_tbl,<br>    .usbdrv.suspend =  rtw_suspend,<br>    .usbdrv.resume = rtw_resume,</p>
<pre><code>#if (LINUX_VERSION_CODE &gt; KERNEL_VERSION(2, 6, 22))
  .usbdrv.reset_resume   = rtw_resume,
#endif
#ifdef CONFIG_AUTOSUSPEND
.usbdrv.supports_autosuspend = 1,
#endif

#if (LINUX_VERSION_CODE &gt;= KERNEL_VERSION(2, 6, 19))
.usbdrv.drvwrap.driver.shutdown = rtw_dev_shutdown,
#else
.usbdrv.driver.shutdown = rtw_dev_shutdown,
#endif
</code></pre><p>};</p>
<p>2）填充该设备的usb_driver结构体成员变量。代码如下：</p>
<pre><code>             static struct usb_driver xxx_usb_wifi_driver = {

                  .name =             &quot;XXX_USB_WIFI&quot;,

                  .probe=   xxx_probe,

                  .disconnect=   xxx_disconnect,

                  .suspend=        xxx_suspend,

                  .resume=         xxx_resume,

                  .id_table=        xxx_table,

             };
</code></pre><p>（3）将该驱动注册到USB子系统。代码如下：<br>                  usb_register(&amp;xxx_usb_wifi_driver);</p>
<p>以上步骤只是一个大致的USB驱动框架流程，而最大和最复杂的工作是填充usb_driver结构体成员变量。以上步骤的主要工作是将USB接口的WIFI设备挂载到USB总线上，以便Linux系统在USB总线上就能够找到该设备。</p>
<p>2、接下来是网络设备的线索，网络设备驱动大致步骤如下：</p>
<pre><code>     （1）定义一个net_device结构体变量ndev。代码如下：

                       struct net_device *ndev;
                               pnetdev = rtw_alloc_etherdev(sizeof(_adapter));

     （2）初始化ndev变量并分配内存。代码如下：

                       ndev=alloc_etherdev();

     （3）填充ndev -&gt; netdev_ops结构体成员变量。代码如下：

     #if (LINUX_VERSION_CODE&gt;=KERNEL_VERSION(2,6,29))
</code></pre><p>static const struct net_device_ops rtw_netdev_ops = {<br>    .ndo_init = rtw_ndev_init,<br>    .ndo_uninit = rtw_ndev_uninit,<br>    .ndo_open = netdev_open,<br>    .ndo_stop = netdev_close,<br>    .ndo_start_xmit = rtw_xmit_entry,</p>
<h1 id="if-LINUX-VERSION-CODE-gt-KERNEL-VERSION-2-6-35"><a href="#if-LINUX-VERSION-CODE-gt-KERNEL-VERSION-2-6-35" class="headerlink" title="if (LINUX_VERSION_CODE&gt;=KERNEL_VERSION(2,6,35))"></a>if (LINUX_VERSION_CODE&gt;=KERNEL_VERSION(2,6,35))</h1><pre><code>.ndo_select_queue    = rtw_select_queue,
</code></pre><h1 id="endif"><a href="#endif" class="headerlink" title="endif"></a>endif</h1><pre><code>.ndo_set_mac_address = rtw_net_set_mac_address,
.ndo_get_stats = rtw_net_get_stats,
.ndo_do_ioctl = rtw_ioctl,
</code></pre><p>};</p>
<h1 id="endif-1"><a href="#endif-1" class="headerlink" title="endif"></a>endif</h1><pre><code>                       static const struct net_device_ops xxx_netdev_ops= {

                                .ndo_init= xxx_ndev_init,

                                .ndo_uninit= xxx _ndev_uninit,

                                .ndo_open= netdev_open,

                                .ndo_stop= netdev_close,

                                .ndo_start_xmit= xxx_xmit_entry,

                                .ndo_set_mac_address= xxx_net_set_mac_address,

                                .ndo_get_stats= xxx_net_get_stats,

                                .ndo_do_ioctl= xxx_ioctl,

                       };

     （4）填充ndev-&gt;wireless_handlers结构体成员变量，该变量是无线扩展功能。代码如下：

                       ndev-&gt;wireless_handlers = (struct iw_handler_def *)&amp;xxx_handlers_def;]
                #ifdef CONFIG_WIRELESS_EXT
</code></pre><p>struct iw_handler_def rtw_handlers_def =<br>{<br>    .standard = rtw_handlers,<br>    .num_standard = sizeof(rtw_handlers) / sizeof(iw_handler),</p>
<h1 id="if-LINUX-VERSION-CODE-lt-KERNEL-VERSION-2-6-33-defined-CONFIG-WEXT-PRIV"><a href="#if-LINUX-VERSION-CODE-lt-KERNEL-VERSION-2-6-33-defined-CONFIG-WEXT-PRIV" class="headerlink" title="if (LINUX_VERSION_CODE &lt; KERNEL_VERSION(2,6,33)) || defined(CONFIG_WEXT_PRIV)"></a>if (LINUX_VERSION_CODE &lt; KERNEL_VERSION(2,6,33)) || defined(CONFIG_WEXT_PRIV)</h1><pre><code>.private = rtw_private_handler,
.private_args = (struct iw_priv_args *)rtw_private_args,
.num_private = sizeof(rtw_private_handler) / sizeof(iw_handler),
 .num_private_args = sizeof(rtw_private_args) / sizeof(struct iw_priv_args),
</code></pre><h1 id="endif-2"><a href="#endif-2" class="headerlink" title="endif"></a>endif</h1><h1 id="if-WIRELESS-EXT-gt-17"><a href="#if-WIRELESS-EXT-gt-17" class="headerlink" title="if WIRELESS_EXT &gt;= 17"></a>if WIRELESS_EXT &gt;= 17</h1><pre><code>.get_wireless_stats = rtw_get_wireless_stats,
</code></pre><h1 id="endif-3"><a href="#endif-3" class="headerlink" title="endif"></a>endif</h1><p>};</p>
<h1 id="endif-4"><a href="#endif-4" class="headerlink" title="endif"></a>endif</h1><pre><code>     （5）将ndev设备注册到网络子系统。代码如下：

                        register_netdev(ndev);

     3、WIFI设备本身私有的功能及属性，如自身的配置及初始化、建立与用户空间的交互接口、自身功能的实现等。

     （1）自身的配置及初始化。代码如下：

                       xxx_read_chip_info();

                       xxx_chip_configure();

                       xxx_hal_init();

     （2）主要是在proc和sys文件系统上建立与用户空间的交互接口。代码如下：

                       xxx_drv_proc_init();

                       xxx_ndev_notifier_register();
</code></pre><p><a href="https://blog.csdn.net/Righthek/article/details/44756433?spm=1001.2014.3001.5502" target="_blank" rel="noopener">https://blog.csdn.net/Righthek/article/details/44756433?spm=1001.2014.3001.5502</a><br><a href="https://blog.csdn.net/Righthek/article/details/53906307?spm=1001.2014.3001.5502" target="_blank" rel="noopener">https://blog.csdn.net/Righthek/article/details/53906307?spm=1001.2014.3001.5502</a></p>
<p>platform 设备驱动<br>总线将设备和驱动绑定。在系统每注册一个设备的时候，会寻找与之匹配的驱动；</p>
<p>Linux 发明了一种虚拟的总线，成为platform总线，相应的设备成为platform_device, 而驱动成为platform_driver.</p>
<p>Linux，用C语言实现类似C++的多态性。</p>
<ol>
<li>file_operations 的读、写、ioctl都被中间层搞定，各种I/O模型也被处理掉了。</li>
<li>中间层实现通用逻辑。可以被底层各种实例共享的代码都被中间层搞定，避免底层重复实现。</li>
<li>对下定义框架。底层的驱动不再需要关心Linux内核VFS的接口和各种可能的I/O模型，而只需要处理与具体硬件相关的访问。</li>
</ol>
<p>cfg80211：用于对无线设备进行配置管理。cfg80211&amp;nl80211基于消息机制，使用netlink接口。</p>
<p>wiphy：无线网络设备驱动使用cfg80211需要硬件设备在cfg80211中实现注册。实现注册就要定义一系列的硬件功能描述的结构体。每个设备的基础性结构体是wiphy，设备连接到系统是，都要使用。每个wiphy有0个，1个或者许多个虚拟接口相关联。</p>
<p><a href="https://zhuanlan.zhihu.com/p/141630753" target="_blank" rel="noopener">https://zhuanlan.zhihu.com/p/141630753</a><br><a href="https://zhuanlan.zhihu.com/p/143096580" target="_blank" rel="noopener">https://zhuanlan.zhihu.com/p/143096580</a><br>iw&lt;—netlink—&gt;cfg80211&lt;—cfg80211_ops—&gt;mac80211-&gt;调用到驱动注册的代码。</p>
<p>// 很关键的一个函数，通过宏定义提供给驱动调用。<br>ieee80211_alloc_hw_nm</p>
<p>mac80211是linux内核子系统，是驱动开发者可用于为softmac无线设备写驱动的框架。mac80211在内核空间实现STA模式。在用户空间实现AP模式。</p>
<p>mac80211_minstrel_ht 速率控制模块<br>mac80211_netdev_notifier 网络设备注册</p>
<p>如果需要通过WEXT操作wifi的话，需要定义CONFIG_CFG80211_WEXT</p>

    </div>

    
    
    

      <footer class="post-footer">

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/06/07/%E4%BF%A1%E5%8F%B7%E5%AE%89%E5%85%A8%E5%87%BD%E6%95%B0/" rel="prev" title="信号安全函数">
      <i class="fa fa-chevron-left"></i> 信号安全函数
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/09/01/%E9%AB%98%E6%95%88%E8%83%BD%E4%BA%BA%E5%A3%AB%E7%9A%84%E4%B8%83%E4%B8%AA%E4%B9%A0%E6%83%AF/" rel="next" title="高效能人士的七个习惯">
      高效能人士的七个习惯 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let activeClass = CONFIG.comments.activeClass;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#什么是USB网络设备驱动。"><span class="nav-number">1.</span> <span class="nav-text">什么是USB网络设备驱动。</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#网络设备驱动"><span class="nav-number">2.</span> <span class="nav-text">网络设备驱动</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#USB设备驱动"><span class="nav-number">3.</span> <span class="nav-text">USB设备驱动</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Model"><span class="nav-number">4.</span> <span class="nav-text">Model</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Training-Detail"><span class="nav-number">5.</span> <span class="nav-text">Training Detail</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#PyTorch-Code"><span class="nav-number">6.</span> <span class="nav-text">PyTorch Code</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Reference"><span class="nav-number">7.</span> <span class="nav-text">Reference</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#if-LINUX-VERSION-CODE-gt-KERNEL-VERSION-2-6-35"><span class="nav-number">8.</span> <span class="nav-text">if (LINUX_VERSION_CODE&gt;&#x3D;KERNEL_VERSION(2,6,35))</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#endif"><span class="nav-number">9.</span> <span class="nav-text">endif</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#endif-1"><span class="nav-number">10.</span> <span class="nav-text">endif</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#if-LINUX-VERSION-CODE-lt-KERNEL-VERSION-2-6-33-defined-CONFIG-WEXT-PRIV"><span class="nav-number">11.</span> <span class="nav-text">if (LINUX_VERSION_CODE &lt; KERNEL_VERSION(2,6,33)) || defined(CONFIG_WEXT_PRIV)</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#endif-2"><span class="nav-number">12.</span> <span class="nav-text">endif</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#if-WIRELESS-EXT-gt-17"><span class="nav-number">13.</span> <span class="nav-text">if WIRELESS_EXT &gt;&#x3D; 17</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#endif-3"><span class="nav-number">14.</span> <span class="nav-text">endif</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#endif-4"><span class="nav-number">15.</span> <span class="nav-text">endif</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">Z.J. Jiang</p>
  <div class="site-description" itemprop="description">about the single image super-resolution and face hallucination</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">42</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">11</span>
        <span class="site-state-item-name">categories</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">1</span>
        <span class="site-state-item-name">tags</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/jzijin" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;jzijin" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="/atom.xml" title="RSS → &#x2F;atom.xml"><i class="fa fa-fw fa-rss"></i>RSS</a>
      </span>
  </div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title">
      <i class="fa fa-fw fa-link"></i>
      Links
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="http://www.njust.edu.cn/" title="http:&#x2F;&#x2F;www.njust.edu.cn" rel="noopener" target="_blank">南京理工大学</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="http://ehall.njust.edu.cn/new/index.html" title="http:&#x2F;&#x2F;ehall.njust.edu.cn&#x2F;new&#x2F;index.html" rel="noopener" target="_blank">南京理工大学智慧服务</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="http://lib.njust.edu.cn/" title="http:&#x2F;&#x2F;lib.njust.edu.cn&#x2F;" rel="noopener" target="_blank">南京理工大学图书馆</a>
        </li>
    </ul>
  </div>

      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Z.J. Jiang</span>
</div>
  <div class="powered-by">Powered by <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> v4.2.0
  </div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">Theme – <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> v7.6.0
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  
      
<script type="text/x-mathjax-config">
    MathJax.Ajax.config.path['mhchem'] = '//cdn.jsdelivr.net/npm/mathjax-mhchem@3';

  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$', '$'], ['\\(', '\\)'] ],
      processEscapes: true,
      skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
    },
    TeX: {
        extensions: ['[mhchem]/mhchem.js'],
      equationNumbers: {
        autoNumber: 'AMS'
      }
    }
  });

  MathJax.Hub.Register.StartupHook('TeX Jax Ready', function() {
    MathJax.InputJax.TeX.prefilterHooks.Add(function(data) {
      if (data.display) {
        var next = data.script.nextSibling;
        while (next && next.nodeName.toLowerCase() === '#text') {
          next = next.nextSibling;
        }
        if (next && next.nodeName.toLowerCase() === 'br') {
          next.parentNode.removeChild(next);
        }
      }
    });
  });

  MathJax.Hub.Queue(function() {
    var all = MathJax.Hub.getAllJax(), i;
    for (i = 0; i < all.length; i += 1) {
      element = document.getElementById(all[i].inputID + '-Frame').parentNode;
      if (element.nodeName.toLowerCase() == 'li') {
        element = element.parentNode;
      }
      element.classList.add('has-jax');
    }
  });
</script>
<script>
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML', () => {
    MathJax.Hub.Typeset();
  }, window.MathJax);
</script>

    

  

</body>
</html>
